<template>
<h1>事件绑定指令</h1>
<!--  将v-on简写成@  -->
    <button @click="f">按钮1</button>
    <button v-on:click="f">按钮2</button>
    <h3>敲回车事件</h3>
    <input type="text" placeholder="请输入您要搜索的内容" v-model="search" @keyup.enter="f2">
</template>

<script setup>
    import {ref} from "vue";

    const f = () => {
        console.log("按钮被点击了")
    }
    //定义变量用来保存搜索框中的数据
    const search = ref('');
    const f2 = () => {
        alert('您想要搜索的是'+search.value+'吗?')
    }
</script>

<style scoped>

</style>